package com.jming.jike.dto.front;

import com.jming.jike.common.ValidatorGroup.Insert;
import com.jming.jike.common.ValidatorGroup.Update;
import com.jming.jike.dto.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author jinming.zhang
 * @version 0.0.1
 * @date 2022/05/13
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AddressBookDTO extends BaseDTO {

    @ApiModelProperty(value = "id")
    @NotNull(message = "id不能为空", groups = {Update.class})
    @Min(value = 1, message = "id最小为{value}", groups = {Update.class})
    private Long id;

    @ApiModelProperty(value = "联系人")
    @NotBlank(message = "联系人不能为空", groups = {Integer.class, Update.class})
    private String consignee;

    @ApiModelProperty(value = "性别 0 女 1 男")
    @NotNull(message = "性别不能为空", groups = {Integer.class, Update.class})
    private Integer sex;

    @ApiModelProperty(value = "手机号")
    @NotBlank(message = "手机号不能为空", groups = {Insert.class, Update.class})
    @Pattern(regexp = "[0-9-()（）]{7,18}", message = "手机号格式不正确", groups = {Insert.class, Update.class})
    private String phone;

    @ApiModelProperty(value = "省级区划编号")
    @NotBlank(message = "省级区划编号不能为空", groups = {Insert.class, Update.class})
    private String provinceCode;

    @ApiModelProperty(value = "省级名称")
    @NotBlank(message = "省级名称不能为空", groups = {Insert.class, Update.class})
    private String provinceName;

    @ApiModelProperty(value = "市级区划编号")
    @NotBlank(message = "市级区划编号不能为空", groups = {Insert.class, Update.class})
    private String cityCode;

    @ApiModelProperty(value = "市级名称")
    @NotBlank(message = "市级名称不能为空", groups = {Insert.class, Update.class})
    private String cityName;

    @ApiModelProperty(value = "区级区划编号")
    @NotBlank(message = "区级区划编号不能为空", groups = {Insert.class, Update.class})
    private String districtCode;

    @ApiModelProperty(value = "区级名称")
    @NotBlank(message = "区级名称不能为空", groups = {Insert.class, Update.class})
    private String districtName;

    @ApiModelProperty(value = "详细地址")
    @NotBlank(message = "详细地址不能为空", groups = {Insert.class, Update.class})
    private String detail;

    @ApiModelProperty(value = "标签")
    private String label;

    @ApiModelProperty(value = "默认 0 否 1是")
    private Integer isDefault;
}
